package com.practice.list;

/**
 * Created with IntelliJ IDEA.
 * Description:测试
 * User: YJ
 * Date: 2023-10-25
 * Time: 15:51
 */
public class SortListTest {
    public static void main(String[] args) {
        //归并排序
        SortList sortList = new SortList();
        //快排
        //SortListByQuickSort quickSort = new SortListByQuickSort();
        //创建测试链表
        ListNode l1 = new ListNode(4);
        ListNode l2 = new ListNode(2);
        ListNode l3 = new ListNode(1);
        ListNode l4 = new ListNode(3);
        l1.next = l2;
        l2.next = l3;
        l3.next = l4;
        l4.next = null;
        ListNode head = l1;
        System.out.println("排序前");
        while (l1 != null) {
            System.out.print(l1.val + "\t");
            l1 = l1.next;
        }
        ListNode listNode = null;
        listNode = sortList.sortList(head);
        //listNode = quickSort.sortList(head);
        System.out.println();
        System.out.println("排序后");
        while (listNode != null) {
            System.out.print(listNode.val + "\t");
            listNode = listNode.next;
        }
        System.out.println();
    }
}
